This fixes a small race between when a domain is created and when xentop
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 24 Nov 2005 10:17:20 +0000 (11:17 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Thu, 24 Nov 2005 10:17:20 +0000 (11:17 +0100)
tries to read it's info from the xenstore. Instead of sending a NULL
pointer for the name the name will be displayed as a ' ' until the next
refresh where xentop will then properly display the name.

Signed-off-by: Jerone Young <jyoung5@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
tools/xenstat/libxenstat/src/xenstat.c

index e01ee8c4ebb44df94b69043fd41a657da0c14119..921c7d29dbcc2c89998f2eef7dff2cd46056e349 100644 (file)
@@ -702,19 +702,12 @@ static char *xenstat_get_domain_name(xenstat_handle *handle, unsigned int domain
 {
        char path[80];
        char *name;
-       struct xs_transaction_handle *xstranshandle;
 
        snprintf(path, sizeof(path),"/local/domain/%i/name", domain_id);
        
-       xstranshandle = xs_transaction_start(handle->xshandle);
-       if (xstranshandle == NULL) {
-               perror("Unable to get transcation handle from xenstore\n");
-               exit(1); /* Change this */
-       }
-
-       name = (char *) xs_read(handle->xshandle, xstranshandle, path, NULL);
-       
-       xs_transaction_end(handle->xshandle, xstranshandle, false);
+       name = xs_read(handle->xshandle, NULL, path, NULL);
+       if (name == NULL)
+               name = strdup(" ");
 
        return name;
 }